package com.mo.controller;

import com.mo.common.Result;
import com.mo.service.UserService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {
    @Resource
    private UserService userService;

    @PreAuthorize("hasAuthority('sys:add') and hasRole('ROLE_ADMIN')")
    @GetMapping("user")
    public Result getUser() {
        return Result.success("查询成功", userService.list());
    }
}
